<template>
  <div class="enterpriseDetail_page">
    <van-nav-bar title="企业认证详情" left-arrow @click-left="$router.back()" />

    <van-notice-bar
      v-if="enterpriseDetailObj.audit_state_desc"
      :text="'当前状态为： ' + enterpriseDetailObj.audit_state_desc"
      left-icon="volume-o"
      :color="allColor[enterpriseDetailObj.audit_state]"
    />

    <com-enterprise-auth :enterpriseObj="enterpriseDetailObj" :isOut="true"></com-enterprise-auth>
  </div>
</template>

<script>
import comEnterpriseAuth from '../../components/comEnterpriseAuth'

const allColor = {
  0: '#1989FA',
  1: '#FF976A',
  2: '#07C160',
  3: '#EE0A24'
}

export default {
  name: 'enterpriseDetail',
  components: {
    comEnterpriseAuth
  },

  data() {
    return {
      allColor,
      enterpriseDetailObj: {},
      companyId: ''
    }
  },
  async created() {
    this.companyId = this.$route.params.id
    const res = await this.$api.authentication.companyInfo(this.companyId)
    //const res = await this.$api.authentication.reqEnterpriseDetailAndAuditInfo(this.companyId)
    if (res.code === 200) {
      this.enterpriseDetailObj = res.data
    }
  },

  destroyed() {
    this.enterpriseDetailObj = {}
  }
}
</script>

<style lang="scss" scoped>
.enterpriseDetail_page {
  width: 100%;
}
</style>
